using IcsSEMCtrl.Util;
using System;
namespace IcsSEMCtrl.Global.Device
{
	public class LocationState
	{
		public const int _EMPTY = 0;
		public const int _RESERVED = 1;
		public const int _OCCUFIED = 2;
		private int _value;
		private static int _size;
		private static LocationState[] _array;
		public static string[] displayStrings;
		public static LocationState[] displayValues;
		public static LocationState EMPTY;
		public static LocationState RESERVED;
		public static LocationState OCCUFIED;
		public static LocationState IT_ENUM_MAX;
		static LocationState()
		{
			LocationState._size = 3;
			LocationState._array = new LocationState[LocationState._size];
			LocationState.displayStrings = new string[LocationState._size];
			LocationState.displayValues = new LocationState[LocationState._size];
			LocationState.EMPTY = new LocationState(0);
			LocationState.RESERVED = new LocationState(1);
			LocationState.OCCUFIED = new LocationState(2);
			LocationState.IT_ENUM_MAX = new LocationState(2147483647);
			LocationState.displayStrings[0] = "EMPTY";
			LocationState.displayStrings[1] = "RESERVED";
			LocationState.displayStrings[2] = "OCCUFIED";
			LocationState.displayValues[0] = LocationState.EMPTY;
			LocationState.displayValues[1] = LocationState.RESERVED;
			LocationState.displayValues[2] = LocationState.OCCUFIED;
		}
		public static string ValueToString(LocationState val)
		{
			string result;
			switch (val.Value())
			{
			case 0:
				result = LocationState.displayStrings[0];
				break;
			case 1:
				result = LocationState.displayStrings[1];
				break;
			case 2:
				result = LocationState.displayStrings[2];
				break;
			default:
				result = "";
				break;
			}
			return result;
		}
		public static LocationState StringToValue(string val)
		{
			LocationState result;
			if (Helper.IsNullOrEmpty(val))
			{
				result = LocationState.IT_ENUM_MAX;
			}
			else
			{
				for (int i = 0; i < LocationState.displayStrings.Length; i++)
				{
					if (val.Equals(LocationState.displayStrings[i]))
					{
						result = LocationState.displayValues[i];
						return result;
					}
				}
				result = null;
			}
			return result;
		}
		public int Value()
		{
			return this._value;
		}
		public static LocationState From_Int(int value)
		{
			LocationState result;
			if (value >= 0 && value < LocationState._size)
			{
				result = LocationState._array[value];
			}
			else
			{
				result = LocationState.IT_ENUM_MAX;
			}
			return result;
		}
		protected LocationState(int value)
		{
			this._value = value;
			if (value >= 0 && value < LocationState._size)
			{
				LocationState._array[this._value] = this;
			}
		}
		public bool Equals(LocationState otherEnum)
		{
			return otherEnum.Value() == this._value;
		}
		public override string ToString()
		{
			return LocationState.displayStrings[this._value];
		}
	}
}
